package com.gwtjs.icustom.pojo;

import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.util.Date;

/**
 * @author : [aGuang]
 * @version : [v1.0]
 * @className : BaseEntity
 * @description : [基础类]
 * @createTime : [2022/11/18 15:32]
 * @updateUser : [aGuang]
 * @updateTime : [2022/11/18 15:32]
 * @updateRemark : [描述说明本次修改内容]
 */
//@MappedSuperclass的类将不是一个完整的实体类，他将不会映射到数据库表，但是他的属性都将映射到其子类的数据库字段中。
@MappedSuperclass

public class BaseEntity {


 	//定义字段以及字段的类型和长度和是否允许为null
    @Column(name = "create_by",columnDefinition = "varchar(32) COMMENT '创建人'",nullable = false)
    private String createdBy;

    @Column(name = "created_id",columnDefinition = "varchar(32) COMMENT '创建人id'",nullable = false)
    private Long createdId;



    @Column(name = "create_time",nullable = false,columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP  COMMENT '创建时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Column(name = "updated_by",columnDefinition = "varchar(32) COMMENT '更新人'")
    private String updateBy;
    @Column(name = "updated_id",columnDefinition = "varchar(32) COMMENT '更新人id'")
    private Long updateId;

	/*定义字段以及字段的类型并默认为当前时间，并当进行修改的时候更新时间为当前实现*/
    @Column(name = "update_time",columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    @Column(name = "is_delete",columnDefinition = "tinyint(1) COMMENT '是否删除(0/1 未删除/删除)'")
    private int isDelete=0;
    @Column(name = "remark",columnDefinition = "varchar(64) COMMENT '备注'")
    private String remark;

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }


    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Long getCreatedId() {
        return createdId;
    }

    public void setCreatedId(Long createdId) {
        this.createdId = createdId;
    }

    public Long getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Long updateId) {
        this.updateId = updateId;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public int getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(int isDelete) {
        this.isDelete = isDelete;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
